<template>
  <el-card>
    <template #header>
      <div class="clearfix">
        <span>投资商列表</span>
        <el-button @click="router.push('/home/partner/investors/add')" style="float: right; padding: 3px 0" type="text">添加</el-button>
      </div>
    </template>
    <el-table :data="investorsList" style="width: 100%">
      <el-table-column prop="id" label="序号" width="50"></el-table-column>
      <el-table-column prop="investorName" label="投资商姓名" ></el-table-column>
      <el-table-column prop="phoneNumber" label="手机号"></el-table-column>
      <el-table-column prop="isCustomer" label="是否客户" width="100" >
        <template #default="scope">
          {{ scope.row.isCustomer ? '是' : '否' }}
        </template>
      </el-table-column>
      <el-table-column prop="investmentType" label="投资类型"></el-table-column>
      <el-table-column prop="investmentAmount" label="出资金额">
        <template #default="scope">
          ¥{{ scope.row.investmentAmount }}
        </template>
      </el-table-column>
      <el-table-column prop="project" label="投资项目"></el-table-column>
      <el-table-column prop="station" label="涉及电站"></el-table-column>
      <el-table-column prop="createdAt" label="创建时间">
        <template #default="scope">
          {{ scope.row.createdAt.substring(0, 10) }}
        </template>
      </el-table-column>
    </el-table>
  </el-card>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { fetchInvestorsList } from "../../../../api/InvestorsApi.ts";
import router from "../../../../router";

const investorsList = ref([]);

const getInvestorsList = async () => {
  const res = await fetchInvestorsList();
  if (res.code === 200) {
    investorsList.value = res.data
  }
};


getInvestorsList();

</script>

<style scoped>
.el-card {
  margin-top: 20px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 #ffffff;
  outline: 0;
}
</style>
